- Preinstallation
- install Node.js https://nodejs.org/en/download/
- install git https://git-scm.com/download/win
- install hexo: right click “git bash here”,
$npm install hexo-cli -g
- SSH keys
- check whether ssh exists
$cd ~/.ssh
. If not,$ssh-keygen -t rsa -C "your_email@example.com"
to generate key file - get the SSH key
$cat ~/.ssh/id_rsa.pub
- create the key in github: account setting->SSH
- check the SSH key
$ ssh -T git@github.com
- check whether ssh exists
create an empty folder as Hexo folder
1
2
3hexo init
hexo generate
hexo serverlocal test: http://localhost:4000/
deploy local Hexo folder
in Hexo folder, modify the _config.yml file as follows,
1
2
3
4deploy:
type: git
repository: $(SSH address from github)
branch: masterin Hexo folder, install the deployer by
$npm install hexo-deployer-git --save
- type
$hexo g
and$hexo d
, or$hexo d -g
.
- change theme: go to the folder “/themes” and
git clone https://github.com/iissnan/hexo-theme-next
. config the theme in the file “/themes/XXXX/_config.yml”. local search
$npm install hexo-generator-searchdb --save
in the site _config.yml file, set
local_search: enable: true
. paste the following lines anywhere.1
2
3
4
5search:
path: search.xml
field: post #post, page, all
format: html
limit: 10000
add new page for some subcategory (e.g., write): in the theme _config.yml file
1
2menu:
write: /categories/writeadd social links: in the theme _config.yml file
1
2
3
4# Social links
social:
GitHub: https://github.com/ustcnewly
Linkedin: https://www.linkedin.com/in/li-niu-b0905133/latex:
- install
$npm install hexo-math --save
and restart Hexo in the theme _config.yml file, modify as follows (notice that
cdn
may change)1
2
3
4
5# MathJax Support
mathjax:
enable: true
per_page: false
cdn: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMMLto address the conflict between MathJax and Hexo
1
2npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
- install
push posts to the top
$ npm install hexo-generator-index-pin-top --save
.- for the target post, add
top: true
in Front-matter, ortop: 10
with larger number indicating higher priority.
insert code block
1
2
3{% codeblock lang:python %}
code snippet
{% endcodeblock %}insert image
1
<img src="http://bcmi.sjtu.edu.cn/~niuli/github_images/t0IXoZq.jpg" width="50%" height="50%">
Tips:
If something is wrong with the representation and hard to tune, you can try deleting extra spaces or adopting an alternative format (e.g., two code block formats).
Case sensitive: sometimes you switch between capital letter and small letter, which may lead to 404 not found errors.
- set
ignorecase
asfalse
in the file.deploy_git/.git/config
- clean the folder
.deploy_git
hexo clean
andhexo d -g
- set